import java.util.Scanner;
//交换两个数
public class Test {
    public static void swap(int a[]) {
        int tmp=a[0];
        a[0]=a[1];
        a[1]=tmp;
    }
    public static void main(String[] args) {
        //交换两个数(在学到new前,需要用数组实现)
        int a[]={10,15};
        System.out.println(a[0]+" "+a[1]);
        swap(a);
        System.out.println(a[0]+" "+a[1]);



        //方法重载和方法重写
        //方法重载：1、方法名相同 2、方法参数类型或个数不同 3、返回值无限制
        //    好处：不需要记太多的方法名
        //
    }

}


//使用函数求最大值,max3中调用max2
class Test1 {
    public static void main(String[] args){
        int a=5;
        int b=7;
        int c=10;
        int ret=max2(a,b);
        int ret2=max3(a,b,c);
        System.out.println(ret);
        System.out.println(ret2);
    }

    public static int max2(int a,int b){
        return a>b?a:b;
    }

    public static int max3(int a,int b,int c){
        int num_max=0;
        num_max=max2(a,b);
        if(num_max==a){
            return max2(a,c);
        }
        else{
            return max2(b,c);
        }
    }
}


//n的阶乘和
class Test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int ret=sum_Mul(n);
        System.out.println(ret);
    }
    //阶乘和
    public static int sum_Mul(int n){
        int sum=0;
        for (int i = 1; i <= n; i++) {
            sum+=Mul(i);
        }
        return sum;
    }
    //阶乘
    public static int Mul(int n){
        int flag=1;
        for (int i = 1; i <= n; i++) {
            flag*=i;
        }
        return flag;
    }
}


//斐波那契数列
class Test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int ret=fib(n);
        System.out.println(ret);
    }
    public static int fib(int n){
        if(n==1||n==2){
            return 1;
        }
        else if(n>2){
            return fib(n-1)+fib(n-2);
        }
        return n;
    }
}


//重载  求和
class Test4 {
    public static void main(String[] args) {
        int a=10;
        int b=20;
        int ret1=sum(a,b);
        System.out.println(ret1);

        double x=1.5;
        double y=3.4;
        double z=2.0;
        double ret2=sum(x,y,z);
        System.out.println(ret2);
    }
    public static int sum(int x,int y){
        return x+y;
    }
    public static double sum(double x,double y,double z){
        return x+y+z;
    }
}


//求最大值 主函数中调用函数，重载
class Test5 {
    public static void main(String[] args){
        int a=5;
        int b=7;
        int ret1=max(a,b);

        double x=1.2;
        double y=2.0;
        double z=5.4;
        double ret2=max(x,y,z);
        System.out.println(ret1);
        System.out.println(ret2);
    }

    public static int max(int a,int b){
        return a>b?a:b;
    }

    public static double max(double a,double b,double c){
        double num_max=0;
        num_max=a>b?a:b;
        num_max=num_max>c?num_max:c;
        return num_max;
    }
}
